package com.zhehekeji.opsys.api.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "t_visit_log_page")
public class TVisitLogPage extends MongoEntity implements java.io.Serializable {

    /**
	 * 
	 */
	private static final long serialVersionUID = 604474451643178210L;

	@Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "ID", length = 20, nullable = false, unique = true)
    private long id;

    @Column(name = "STB_TYPE", length = 255, nullable = true)
    private String stbType;

    /**
     * 平台：华为 0：中兴 1
     */
    @Column(name = "PLATFORMTYPE", length = 2, nullable = true)
    private Integer platformType;

    /**
     * 当前页面标识
     */
    @Column(name = "PAGE_IDENTITY", length = 64, nullable = true)
    private String pageIdentity;

    /**
     * 当前页面名称
     */
    @Column(name = "PAGE_NAME", length = 500, nullable = true)
    private String pageName;

    /**
     * 省份标识
     */
    @Column(name = "PROVINCE_IDENTITY", length = 64, nullable = true)
    private String provinceIdentity;

    /**
     * 省份名称
     */
    @Column(name = "PROVINCE_NAME", length = 500, nullable = true)
    private String provinceName;

    /**
     * 上级页面来源标识
     */
    @Column(name = "PARENET_PAGE_IDENTITY", length = 64, nullable = true)
    private String parentPageIdentity;

    /**
     * 内容CODE
     */
    @Column(name = "CONTENT_CODE", length = 64, nullable = true)
    private String contentCode;

    /**
     * 内容名称
     */
    @Column(name = "CONTENT_NAME", length = 128, nullable = true)
    private String contentName;

    /**
     * 栏目CODE
     */
    @Column(name = "CATEGORY_CODE", length = 64, nullable = true)
    private String categoryCode;

    /**
     * 栏目名称
     */
    @Column(name = "CATEGORY_NAME", length = 128, nullable = true)
    private String categoryName;

    @Column(name = "GROUP_NO", length = 255, nullable = true)
    private String groupNo;

    /**
     * 上报时间
     */
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "VISIT_TIME", nullable = true)
    private Date visitTime;

    @Column(name = "ACCOUNT", length = 255, nullable = true)
    private String account;

    @Column(name = "PRODUCT_CODE", length = 64, nullable = true)
    private String productCode;

    @Column(name = "PRODUCT_NAME", length = 255, nullable = true)
    private String productName;

    @Column(name = "CP_CODE", length = 20, nullable = true)
    private Long cpCode;

    /**
     * 上报类型：1 页面访问，2 按钮上报
     */
    @Column(name = "TYPE", length = 11, nullable = true)
    private Integer type;

    @Column(name = "RESOLUTION", length = 2, nullable = true)
    private Integer resolution;

    @Column(name = "AREA_ID", length = 64, nullable = true)
    private String areaId;

    @Column(name = "EPG_PLATFORM_TYPE", length = 2, nullable = true)
    private Integer epgPlatformType;

    public TVisitLogPage(long id) {
        this.id = id;
    }

    public TVisitLogPage(long id, String stbType, String groupNo, Date visitTime,
                     String account, String productCode,
                     String productName, Long cpCode, Integer type) {
        this.id = id;
        this.stbType = stbType;
        this.groupNo = groupNo;
        this.visitTime = visitTime;
        this.account = account;
        this.productCode = productCode;
        this.productName = productName;
        this.cpCode = cpCode;
        this.type = type;
    }

    @Override
    public String toString() {
        return "TVisitLogPage [id=" + id + ", stbType=" + stbType + ", groupNo="
                + groupNo + ", visitTime=" + visitTime + ", account=" + account
                + ", productCode=" + productCode + ", productName="
                + productName + ", cpCode=" + cpCode + "]";
    }
}
